cmake_minimum_required(VERSION 3.4.1)


set(ABI ${ANDROID_ABI})
#set(ABI "armeabi")
#set(ABI "arm64-v8a")

set(distribution_DIR ${CMAKE_SOURCE_DIR}/ndkLibs})
set(distribution_DIR_ABI ${CMAKE_SOURCE_DIR}/ndkLibs/${ABI})


add_library(avutil
        SHARED
        IMPORTED)
set_target_properties(
        avutil
        PROPERTIES IMPORTED_LOCATION
        ${distribution_DIR_ABI}/libavutil.so
)

add_library(swresample
        SHARED
        IMPORTED)
set_target_properties(
        swresample
        PROPERTIES IMPORTED_LOCATION
        ${distribution_DIR_ABI}/libswresample.so
)

add_definitions(-DUSE_ARM_NEON)

add_library(
        audioresample
        SHARED
        resample/native-lib.cpp
        resample/AudioResample.cpp
)

find_library(
        log-lib
        log)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

include_directories(${CMAKE_SOURCE_DIR}/resample/include)

target_link_libraries(
        audioresample
        swresample
        avutil
        ${log-lib})